﻿using System;
using log4net;
using Metozis.Facade;
using Metozis.View;
using Microsoft.Practices.Unity;

namespace Metozis
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            IUnityContainer container=new UnityContainer();

            ILog log = LogManager.GetLogger("Metozis");
            container.RegisterInstance<ILog>(log);

            container.Resolve(Type.GetType("Metozis.MetozisCoreModule,MetozisCore"));
            container.Resolve(Type.GetType("Metozis.MetozisDataModule,MetozisData"));
            container.Resolve(Type.GetType("Metozis.MetozisClientModule,MetozisClient"));

            IOrderFacade facade = container.Resolve<IOrderFacade>();

            log.InfoFormat("Started");
            Console.WriteLine("Press any key");
            Console.Read();
            for (int i = 0; i < 5; i++)
            {
                new OrderView(facade).Show(i+1);
            }
            
            log.InfoFormat("Ended" + Environment.NewLine);
            Console.ReadLine();

        }
    }
}